The ColorPicker Component > Using the ColorPicker component > Creating an application with the ColorPicker component

 

Creating an application with the ColorPicker component

The following procedure describes how to create a simple application with the ColorPicker component. In this procedure, you enter simple ActionScript code to affect the component. For a more complex example, see Examples for the ColorPicker component.

 
To create a simple application using the ColorPicker component:

1

Open Macromedia Flash MX.

2

Open the Components panel (Window > Components).

3

Select Flash UI Components Set 4 from the Components panel menu.

4

Drag an instance of the ColorPicker component onto the stage.

5

Set the instance name of the ColorPicker to myPicker_cp.

6

Set the change handler for the ColorPicker to be onChooseColor.

7

Add a new layer to the main timeline and name it actions (make sure it's the topmost layer).

8

Select the new layer and open the Actions panel (Window > Actions).

9

In the Actions panel add the follow code:

onChooseColor = function(){
	var result = myPicker_cp.getValue();
	trace(result);
}

10

Save, publish, and test the movie.